#ifndef CLOCK_LAPITEM_HPP
#define CLOCK_LAPITEM_HPP

#include <cpp3ds/Graphics/Drawable.hpp>
#include <cpp3ds/Graphics/Text.hpp>
#include <cpp3ds/Window/Event.hpp>
#include <cpp3ds/System/Clock.hpp>
#include "TweenObjects.hpp"
#include "Chronometer.hpp"
#include <TweenEngine/Tween.h>
#include <TweenEngine/TweenManager.h>
#ifndef EMULATION
#include <3ds.h>
#endif

namespace Clock {

class LapItem : public cpp3ds::Drawable, public util3ds::TweenTransformable<cpp3ds::Transformable> {
public:
	void update(float delta);
	void processEvent(const cpp3ds::Event& event);

	float getHeight() const;

	int getIndex();
	cpp3ds::Time getTime();

	LapItem(int lapCount, cpp3ds::Time fullTime, cpp3ds::Time oldTime);
	~LapItem();

protected:
	virtual void draw(cpp3ds::RenderTarget& target, cpp3ds::RenderStates states) const;

private:
	float m_height;

	int m_index;
	cpp3ds::Time m_time;

	util3ds::TweenText m_textTime;
	util3ds::TweenText m_textLap;
	util3ds::TweenText m_textTimeDiff;
	util3ds::TweenRectangleShape m_itemBackground;

	TweenEngine::TweenManager m_tweenManager;

};

} // namespace Clock

#endif // CLOCK_LAPITEM_HPP
